<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" href="../../css/vant.css">
    <style>
        body {
            background: #F8F8FE;
        }

        .slideshow {
            width: 17.55rem;
            height: 7.5rem;
            margin-top: .7rem;
            border-radius: .5rem;
            margin-left: .6rem;
        }

        .padding {
            padding-top: 1rem;

        }

        .index_box {
            display: flex;
            margin-bottom: 10px;
        }

        .index {
            /* background-color: #fff; */
            /* border-radius: 1rem 1rem 0 0; */
            /* display: inline-block; */
            margin-left: 0.8rem;
            background-image: url('../../image/wenzheng.png');
            width: 5rem;
            height: 4rem;
            background-size: 100% 100%;
        }

        .index .item {
            /* background-color: #DF4C4C; */
            border-radius: 6px;
            width: 5rem;
            height: 4rem;
        }

        .index .item p {
            padding-left: 0.75rem;
            padding-top: 0.6rem;
            font-size: 0.8rem;
            color: #fff
        }

        .index_kaiyao {
            /* background-color: #fff; */
            /* border-radius: 1rem 1rem 0 0; */
            /* display: block; */
            margin-left: 0.8rem;
            background-image: url('../../image/kaiyao.png');
            width: 5rem;
            height: 4rem;
            background-size: 100% 100%;
        }

        .index_kaiyao .item {
            /* background-color: #DF4C4C; */
            border-radius: 6px;
            width: 5rem;
            height: 4rem;
        }

        .index_kaiyao .item p {
            padding-left: 0.75rem;
            padding-top: 0.6rem;
            font-size: 0.8rem;
            color: #fff
        }

        .index_yiyuan {
            /* background-color: #fff; */
            /* border-radius: 1rem 1rem 0 0; */
            /* display: inline-block; */
            margin-left: 0.8rem;
            background-image: url('../../image/yiyuan.png');
            width: 5rem;
            height: 4rem;
            background-size: 100% 100%;
        }

        .index_yiyuan .item {
            /* background-color: #DF4C4C; */
            border-radius: 6px;
            width: 5rem;
            height: 4rem;
        }

        .index_yiyuan .item p {
            padding-left: 0.75rem;
            padding-top: 0.6rem;
            font-size: 0.8rem;
            color: #fff
        }


        /* .item3 {
            background-color: #fff;
            border-radius: 1rem 1rem 0 0;

            padding: 1rem;
        }

        .item3 .item {
            text-align: center;
            display: inline-block;
            width: 33.3%;
            margin-left: -0.25rem;
        }

        .item3 .item:active {
            background-color: #f5f5f5;
        }

        .item3 .item img {
            width: 2rem;
            height: 2rem;
        }

        .item3 .item .find {
            font-size: 0.7rem;
            padding: 0.5rem 0;
        }

        .item3 .item .list {
            font-size: 0.6rem;
        } */

        .item4 {
            width: 100%;
            background-color: #fff;
            border-radius: 0 0 1rem 1rem;

        }

        .item4 .item {
            display: inline-block;
            width: 7rem;
            height: 3.2rem;
            margin: 0 0 1rem 1rem;
        }

        .item4 .item img {
            width: 100%;
            height: 100%;
        }

        .item12 {
            width: 100%;
            display: flex;
            flex-wrap: wrap;
            flex-direction: row;
        }

        .item12 .item {
            width: 20%;
            /* margin-left: -0.25rem; */
            text-align: center;

        }

        .item12 .item img {
            width: 1.75rem;
            height: 1.75rem;
            border-radius: 1.2rem;
        }

        .item12 .item p {
            font-size: 0.6rem;
            padding: 0.5rem 0 1.5rem 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .mingyituijian .title {
            font-size: 0.7rem;
            padding-bottom: 0.5rem;
            padding: 0 0.8rem;
        }

        .mingyituijian .title span {
            color: #838383;
            font-size: 0.5rem;
            margin-left: 1rem;
        }

        .mingyituijian .cate {
            width: 100%;
            height: 1.6rem;
            line-height: 1.6rem;
            margin-top: 1.5rem;
            /* border-top: 1px solid #e8e8e8; */
            /* border-bottom: 1px solid #e8e8e8; */
        }

        .mingyituijian .cate .item {
            width: 24%;
            margin-left: -0.25rem;
            text-align: center;
            font-size: 0.6rem;
            display: inline-block;
            position: relative;
        }

        .mingyituijian .cate .item img {
            width: 0.4rem;
            height: 0.3rem;
            float: right;
            top: 0.6rem;
            margin-left: 0.5rem;
            position: absolute;
        }

        .doctor {
            width: 100%;
        }

        .doctor .item {
            height: 6rem;
            padding: 1rem 0;
            /* border-bottom: 1px solid #e8e8e8; */
            position: relative;
        }

        .doctor .nav {
            width: 100%;
            height: 0.4rem;
            background-color: #F7F7F7;
            position: relative;
            top: 7rem;
        }

        .doctor .item .doctor_avater {
            width: 2.2rem;
            height: 2.2rem;
            position: absolute;
            left: 0;
            top: 1rem;
            border-radius: 50%;
            padding: 0 0.8rem;

        }

        .doctor .item .title {
            font-size: 0.9rem;
            position: absolute;
            top: 1.2rem;
            left: 3rem;
            font-family: PingFang SC;
            color: #303241;
            font-weight: Medium;
            margin-bottom: 0.5rem;
        }

        .doctor .item .title span {
            font-size: 0.6rem;
            color: #F25F50;
            margin-left: 0.2rem;
            background-color: #FFE8E8;
            width: 2.9rem;
            height: 1rem;
            border-radius: 3px;
            line-height: 1rem;
            text-align: center;
        }


        .doctor .item .subtitle {
            font-size: 0.7rem;
            position: absolute;
            top: 2.7rem;
            left: 3.8rem;
            font-weight: 1000;
        }

        .doctor .item .skilled {
            width: 13.75rem;
            color: #838383;
            font-size: 0.7rem;
            top: 3.75rem;
            left: 3.8rem;
            position: absolute;
            margin-top: 0.2rem;

        }

        .doctor .item .item_wenzhen {
            position: absolute;
            bottom: 0.9rem;
            left: 0;
            width: 100%;
        }

        .doctor .item .item_wenzhen .pingjia {
            display: flex;
            margin-left: 3.8rem;
            align-items: center;
        }

        .doctor .item .item_wenzhen .pingjia .pingjia-left {
            display: flex;
            font-size: 0.7rem;
        }

        .doctor .item .item_wenzhen .pingjia .pingjia-left .pingjia-left-pingjia {
            color: #898A95;
        }

        .doctor .item .item_wenzhen .pingjia .pingjia-left .pingjia-left-pingjia span {
            color: #FFAF2B;
        }

        .doctor .item .item_wenzhen .pingjia .pingjia-left .pingjia-left-shuliang {
            color: #898A95;
            margin-left: 0.7rem;
        }

        .doctor .item .item_wenzhen .pingjia .pingjia-left .pingjia-left-shuliang span {
            color: #FFAF2B;
        }

        .doctor .item .item_wenzhen .pingjia .pingjia-right {
            display: flex;
            width: 4.3rem;
            height: 1.7rem;
            background-color: #F25F50;
            border-radius: 6px;
            align-items: center;
            justify-content: space-around;
            padding: 0 0.1rem;
            margin-left: 0.9rem;
        }

        .doctor .item .item_wenzhen .pingjia .pingjia-right img {
            width: 0.7rem;
            height: 0.7rem;
        }

        .doctor .item .item_wenzhen .pingjia .pingjia-right p {
            font-size: 0.7rem;
            color: #FFFFFF;
        }

        .doctor .item .item_wenzhen .item_wenzhen_item {
            display: inline-block;
            width: 33.3%;
            text-align: center;
            margin-left: -0.25rem;
            color: #838383;
            font-size: 0.6rem;
        }

        .doctor .item .item_wenzhen .item_wenzhen_item img {
            width: 0.6rem;
            height: 0.6rem;
            margin-right: 0.5rem;
            margin-top: -0.1rem;
        }

        .none {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 6rem;
            font-size: 0.8rem;
        }

        .my-swipe .van-swipe-item img {
            height: 10rem;
        }

        .doctor_div {
            width: 100%;

        }

        .doctor_div .title {
            padding: 0 .9rem;
            text-align: center;
            font-size: .9rem;
            font-weight: bold;
        }

        .doctor_div .title span {
            /* margin-top: -1rem; */
            height: 0.2rem;
            display: inline-block;
            border-top: 1px dashed #ccc;
            width: 5rem;
            margin: 0 0.6rem;
        }

        .doctor_div .tips {
            padding: 1rem .9rem;
            overflow-x: scroll;
            white-space: nowrap;
        }

        .doctor_div .tips .tip {
            display: inline-block;
            background-color: #f8f8fe;
            padding: .1rem 0.8rem;
            border-radius: .5rem;
            font-size: .8rem;
            border: 1px solid #eeebeb;
            margin-right: 0.2rem;
        }

        .active {
            background-color: #f4f2e9 !important;
        }

        .doctor_item {
            /* text-align: center; */
            padding: 0 .9rem;
        }

        .doctor_item .item {
            text-align: center;
            font-size: .7rem;
            border: 1px solid #F9F2F2;
            border-radius: .5rem;
            display: inline-block;
            width: 5rem;
            padding: .5rem 0;
            background-color: #fff;
            margin-bottom: 0.5rem;
            margin-right: 0.5rem;
        }

        .doctor_item .item:nth-child(3n) {
            margin-right: 0;
        }

        .doctor_item .item img {
            width: 4rem;
            height: 4rem;
            border-radius: 50%;
        }

        .doctor_item .item .cate {
            margin: 0.5rem 0;
            color: #d8800f;
        }

        .doctor_item .item .name {
            font-weight: bold;
            font-size: 0.6rem;
            padding: 0 0.1rem;
        }

        .doctor_item .item .hospital {
            font-size: .5rem;
            padding: 0.2rem 0.3rem;
        }

        .doctor_item .item .price {
            color: #f9041c;
        }

        .doctor_item .item .price span {
            color: #757373;
            font-size: .6rem;
        }

        .doctor_div .more {
            width: 100%;
            text-align: center;
            margin: 1rem 0;
            font-size: 0.8rem;
        }

        .show {
            position: fixed;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            display: flex;
            justify-content: center;
            /* 水平居中 */
            align-items: center;
            /* 垂直居中 */
        }

        .show .main {
            width: 70%;
            min-height: 3rem;
            background-color: #fff;
            border-radius: 0.5rem;
            padding: 0.5rem 0.5rem 0 0.5rem;
            text-align: center;
        }

        .show .main .title {
            font-size: 1rem;
            font-weight: bold;
            margin-bottom: 0.5rem;
        }

        .show .main .subtitle {
            font-size: 0.7rem;
            text-align: left;
        }

        .show .main .subtitle span {
            color: #2780e8;
        }

        .show .main .btnDiv {
            display: flex;
            flex-direction: row;
            border-top: 1px solid #ccc;
            margin-top: 0.5rem;
        }

        .show .main .btnDiv div {
            width: 50%;
            text-align: center;
            font-size: 0.8rem;
            padding: 0.6rem 0;
        }

        .show .main .btnDiv div:last-child {
            color: #2780e8;
            border-left: 1px solid #ccc;
            box-sizing: border-box;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak>
        <!--轮播图-->
        <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
            <van-swipe-item v-for="(item, index)  in Lunbo_imgs" :key="index">
                <img :src="IMAGE_HTTP + item.image" alt="">
            </van-swipe-item>
        </van-swipe>
        <div style="background-color: #F8F8FE;padding: 1rem 0;">
            <div class="item12">
                <div class="item" v-for="(item,index) in nav_data" @click="keshi(item)">
                    <img :src="IMAGE_HTTP + item.image" alt="">
                    <p>{{item.name}}</p>
                </div>

                <!-- <div class="item" @click="keshi_more()">
                    <img src="../../image/icon_more.png" alt="">
                    <p>更多</p>
                </div> -->

            </div>

            <div class="doctor_div">
                <div class="title">
                    <span></span>名医推荐<span></span>
                </div>
                <div class="doctor_item">
                    <div class="item" @click="detail_page(item.doctorId)" v-for="item in doctor_data">
                        <img :src="IMAGE_HTTP + item.avatar" alt="" v-if="item.avatar">
                        <img class="doctor_avater" src="../../image/user_avater.png" alt="" v-else
                            @click="detail_page(item.id)">
                        <div v-if="item.department" class="cate">{{item.department}}</div>
                        <div v-else>暂无科室信息</div>
                        <div class="name p_hide">{{item.name}} {{item.jobtitle}}</div>
                        <div class="hospital p_hide" v-if="item.hospital">{{item.hospital}}</div>
                        <div class="hospital p_hide" v-else>暂无医院</div>
                        <div class="price">￥{{item.price}} <span>起</span></div>
                    </div>
                </div>
                <div class="more" onclick="go_zhaoyisheng_win()">更多医生 > </div>
            </div>
        </div>

        <div class="show" v-if="showText">
            <div class="main">
                <div class="title">服务协议和隐私策略</div>
                <p class="subtitle">
                    请您务必谨慎阅读，充分理解“服务协议”和“隐私策略”各条款，包括但不限于：为了向您提供即时通讯、内容分享等服务，我们需要收集您的设备信息、操作日志等个人信息。您可以在“设置”中查看、变更、删除个人信息并管理您的授权。
                    <br>
                    您可以阅读<span onclick="go_xieyi()">《服务条款》</span>和 <span
                        onclick="go_yinsi()">《隐私策略》</span>理解详情信息。如您同意，请点击同意开始接受我们的服务。
                </p>

                <div class="btnDiv">
                    <div @click="no">暂不使用</div>
                    <div @click="agree">同意</div>
                </div>
            </div>
        </div>
    </div>
</body>

</html>
<script src="../../script/set_root.js"></script>

<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="../../script/hb.js"></script>
<script type="text/javascript" src="../../script/vue.js"></script>
<script type="text/javascript" src="../../script/vant.js"></script>
<script type="text/javascript">
    apiready = function () {
        hb_ready();
        get_lunbo() // 获取轮播数据
        get_nav() // 获取导航数据
        get_doctor() // 获取主页医生数据

        if (!$api.getStorage("first_login") || $api.getStorage("first_login") == "false") {
            app.showText = true
        }
    }

    var app = new Vue({
        el: "#app",
        data: {
            page: 1, // 页码
            Lunbo_imgs: [], // 轮播图数据
            doctor_data: [], // 医生数据
            nav_data: [], // 导航数据，
            IMAGE_HTTP: IMAGE_HTTP,
            showText: false,
        },

        methods: {
            no() {
                api.closeWidget({
                    id: "A6040823957394",
                    retData: {
                        name: 'closeWidget'
                    },
                    animation: {
                        type: 'flip',
                        subType: 'from_bottom',
                        duration: 500
                    },
                    silent: true
                });
            },
            agree() {
                app.showText = false
                $api.setStorage("first_login", true)
            },
            keshi: function (item) {
                // alert(JSON.stringify(item))
                api.openWin({
                    name: 'zhaoyisheng_win',
                    url: 'widget://html/zhaoyisheng_win.html',
                    pageParam: {
                        selectId: item.linkUrl,
                        title: item.name,
                    }
                })
            },
            keshi_more: function () {
                api.openWin({
                    name: 'select_keshi_win',
                    url: 'widget://html/select_keshi_win.html',
                    pageParam: {
                        selectId: '',
                    }
                })
            },

            detail_page: function (id) {
                api.openWin({
                    name: 'doctor_detail_win',
                    url: 'widget://html/doctor_detail_win.html',
                    pageParam: {
                        id: id
                    }
                })
            }
        }

    })

    function go_xieyi() {
        api.openWin({
            name: "fuwu_tiaokuan_win",
            url: "widget://html/fuwu_tiaokuan_win.html",
        })
    }

    function go_yinsi() {
        api.openWin({
            name: "yinsi_win",
            url: "widget://html/yinsi_win.html",
        })
    }

    function go_zhaoyisheng_win() {
        api.openWin({
            name: "zhaoyisheng_win",
            url: "widget://html/zhaoyisheng_win.html",
        })
    }

    // 获取轮播数据
    function get_lunbo() {
        get_ajax("portal/index/slide", {}, function (res, err) {
            // alert(JSON.stringify(res))
            // alert(JSON.stringify(err))
            if (res.code == 2000 && res.data != "") {
                app.Lunbo_imgs = res.data
            }
        })
    }

    // 获取导航数据
    function get_nav() {
        get_ajax("portal/index/nav", {}, function (res, err) {
            // alert(JSON.stringify(res))
            // alert(JSON.stringify(err))
            if (res.code == 2000) {
                app.nav_data = res.data
            }
        })
    }

    // 获取主页医生数据
    function get_doctor() {
        get_ajax("portal/index/doctor", {

        }, function (res, err) {
            // alert(JSON.stringify(res))
            // alert(JSON.stringify(err))
            if (res.code == 2000) {
                if (app.page == 1) {
                    app.doctor_data = res.data
                } else if (app.page > 1) {
                    app.doctor_data = app.doctor_data.concat(res.data)
                } else if (res.data.length == 0) {
                    toast("已经没有了~")
                }
                app.$nextTick(function () {
                    hb_init_openwinby_click();
                })
            }
        })
    }
</script>